var myMixin = {
	data() {
		return {
			//主题样式
			styleObject: {
				backgroundColor: '#5193f3',
				buttonColor: '#3c9cff',
				pageBackgroundColor: '#ffffffb0',
			},
			pageData: {
				total: 0, //查询列表总记录数
				size: 20, //每页显示条数，默认 10
				current: 1, //当前页
				loadmoreStatus: 'nomore', //加载状态
			}
		}
	},
	mounted() {
		this.getThemeColor();
	},
	methods: {
		//点击加载
		loadmore() {
			this.pageData.loadmoreStatus = "loading";
			this.pageData.current++;
			this.getData();
		},
		//还原到第一页
		restoreFirst(){
			this.pageData.total = 0;
			this.pageData.current = 1; //当前页
		},
		// 计算加载状态
		calculateLoadmoreStatus() {
			let size = Math.ceil(this.pageData.total / this.pageData.size);
			if (this.pageData.current >= size) {
				this.pageData.loadmoreStatus = "nomore";
			} else if (this.pageData.current < size) {
				this.pageData.loadmoreStatus = "loadmore";
			}
		},
		//获取主题色
		getThemeColor() {
			let selectTheme = this.$store.state.selectTheme;
			this.styleObject = {
				backgroundColor: selectTheme ? selectTheme.value.dark : '#5193f3',
				buttonColor: selectTheme ? selectTheme.value.normal : '#3c9cff',
				pageBackgroundColor: selectTheme ? selectTheme.value.light : '#f1f1f1',
				pageContentBackgroundColor: selectTheme ? (selectTheme.color == '#3c9cff' ?  '#fff': selectTheme.value.light) : '#fff',
			};
			setTimeout(() => {
				// uni.setNavigationBarColor({
				// 	frontColor: '#000000',
				// 	backgroundColor: selectTheme ? selectTheme.value.light : '#ff0000',
				// 	animation: {
				// 		duration: 400,
				// 		timingFunc: 'easeIn'
				// 	}
				// })
			}, 200)

			console.log("getThemeColor");
		},
	}
}

export default myMixin